home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
toolkit
/
riruf1
/
rufstate.bas
< prev
next >
Wrap
BASIC Source File
|
1995-03-27
|
1KB
|
42 lines
Option Explicit
Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Any) As Long
Const sStateList = "AL,AK,AZ,AR,CA,CO,CT,DC,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VT,VI,WA,WV,WI,WY,"
Function CheckState (sState As String) As Integer
CheckState = False
If Len(sState) < 2 Then
Exit Function
End If
sState = sState & ","
If InStr(sStateList, sState) Then
CheckState = True
End If
End Function
Sub FillStates (ctrl As ComboBox)
Dim n%, i%
Dim statenm$
n% = 2
statenm$ = Left$(sStateList, n%)
ctrl.AddItem statenm$
For i% = 1 To 52
n% = n% + 3
statenm$ = Right$(Left$(sStateList, n%), 2)
ctrl.AddItem statenm$
Next i%
End Sub
Sub FindState (sInpState As String, cboCtrl As ComboBox)
Dim nIndex%
nIndex = SendMessage(cboCtrl.hWnd, CB_FINDSTRINGEXACT, -1, sInpState)
cboCtrl.ListIndex = nIndex
End Sub